package com.mfnote.adapter;



import com.mfnote.view.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class HandWritingAdapter extends BaseAdapter {
	private LayoutInflater infalter = null;

	private ImageView imageView = null;
	private TextView textView = null;

	private View view = null;

	private String[] names = { "换行", "空格", "撤销","保存" ,"更多"};

	private int[] imageID = { 
			R.drawable.newhand_menu_nextline, R.drawable.newhand_menu_space,R.drawable.undo,
			R.drawable.save,R.drawable.more };

	public HandWritingAdapter(Context context) {

		infalter = LayoutInflater.from(context);
	}

	@Override
	public int getCount() {
		return imageID.length;
	}

	@Override
	public Object getItem(int position) {
		return position;
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {

		if (convertView == null) {
			view = infalter.inflate(R.layout.newhand_bottom, null);
		} else {
			view = convertView;
		}

		imageView = (ImageView) view.findViewById(R.id.newHand_bottom_item_iv);

		textView = (TextView) view.findViewById(R.id.newHand_bottom_item_tv);

		imageView.setBackgroundResource(imageID[position]);
		textView.setText(names[position]);
		return view;
	}

}